<?php
// Tim'Roster
// Copyright (c) 2011 Nicolas Nallet <aspgic2@gmail.com>
//
// This file is part of Tim'Roster.
//
// Tim'Roster is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// Tim'Roster is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA

$xml_config = simplexml_load_file('config.xml');
include_once($_SERVER["DOCUMENT_ROOT"].$xml_config->roster_root_directory.'/technical_class/language/language.php');
include_once($_SERVER["DOCUMENT_ROOT"].$xml_config->roster_root_directory.'/class/Character.php');
include_once ($_SERVER["DOCUMENT_ROOT"].$xml_config->roster_root_directory.'/web_ui/common_function.php');
require_once($_SERVER["DOCUMENT_ROOT"].$xml_config->roster_root_directory.'/external_libraries/ryzom_api/ryzom_api.php');


/** Character skills render functions **/

function render_character_general_information(Character $character){

    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_information');
    $column_array[] = Language::get_instance()->get_label('lb_value');
    
    $content = generate_html_table_header($column_array, 350, true);
    $content .= generate_html_table_row(Language::get_instance()->get_label('lb_name'), $character->get_name());
    $content .= generate_html_table_row(Language::get_instance()->get_label('lb_guild'), ryzom_guild_icon_image($character->get_guild_icon(), 's').'  '.$character->get_guild_name());
    $content .= generate_html_table_row(Language::get_instance()->get_label('lb_race'), $character->get_race());

    if ($character->get_gender() == 'm') {
        $content .= generate_html_table_row(Language::get_instance()->get_label('lb_char_gender'),Language::get_instance()->get_label('lb_char_gender_male'));
    }
    else {
        $content .= generate_html_table_row(Language::get_instance()->get_label('lb_char_gender'),Language::get_instance()->get_label('lb_char_gender_female'));
    }

    //TODO : remove english language hard coded for the character title
    $content .= generate_html_table_row(Language::get_instance()->get_label('lb_title'), ryzom_title_txt($character->get_titleid(), 'en', $character->get_gender())); 
    $content .= generate_html_table_row(Language::get_instance()->get_label('lb_money'),  number_format($character->get_money(), 0, '.', ' '));
    $content .= generate_html_table_row(Language::get_instance()->get_label('lb_grade'), Guild_Member::get_grade_label($character->get_grade_id()));
    $content .= generate_html_table_row(Language::get_instance()->get_label('lb_joined_date'), $character->get_joined_date());
    $content .= generate_html_table_row(Language::get_instance()->get_label('lb_civilization'), $character->get_civilization());
    $content .= generate_html_table_row(Language::get_instance()->get_label('lb_cult'), $character->get_cult());
    $content .= generate_html_table_row(Language::get_instance()->get_label('lb_last_update_date'), $character->get_last_update_date());


    $content .= generate_html_table_footer();



    return $content;
}

function render_character_fight_skill(Character $character){

    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_skill_fight_1h');
    $column_array[] = Language::get_instance()->get_label('');

    $skill_fight_1h_table = generate_html_table_header($column_array, 238, true);
    $skill_fight_1h_table .= generate_html_table_row(Language::get_instance()->get_label('lb_1h_mace'),$character->get_mace_1h());
    $skill_fight_1h_table .= generate_html_table_row(Language::get_instance()->get_label('lb_1h_staff'),$character->get_staff_1h());
    $skill_fight_1h_table .= generate_html_table_row(Language::get_instance()->get_label('lb_1h_spear'),$character->get_spear_1h());
    $skill_fight_1h_table .= generate_html_table_row(Language::get_instance()->get_label('lb_1h_axe'),$character->get_axe_1h());
    $skill_fight_1h_table .= generate_html_table_row(Language::get_instance()->get_label('lb_1h_sword'),$character->get_sword_1h());
    $skill_fight_1h_table .= generate_html_table_row(Language::get_instance()->get_label('lb_1h_dagger'),$character->get_dagger_1h());
    $skill_fight_1h_table .= generate_html_table_row(Language::get_instance()->get_label('lb_hand_to_hand'),$character->get_hand_to_hand());
    $skill_fight_1h_table .= generate_html_table_footer();


    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_skill_fight_2h');
    $column_array[] = Language::get_instance()->get_label('');

    $skill_fight_2h_table = generate_html_table_header($column_array, 238, true);
    $skill_fight_2h_table .= generate_html_table_row(Language::get_instance()->get_label('lb_2h_mace'),$character->get_mace_2h());
    $skill_fight_2h_table .= generate_html_table_row(Language::get_instance()->get_label('lb_2h_pike'),$character->get_pike_2h());
    $skill_fight_2h_table .= generate_html_table_row(Language::get_instance()->get_label('lb_2h_axe'),$character->get_axe_2h());
    $skill_fight_2h_table .= generate_html_table_row(Language::get_instance()->get_label('lb_2h_sword'),$character->get_sword_2h());
    
    $skill_fight_2h_table .= generate_html_table_footer();


    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_skill_range');
    $column_array[] = Language::get_instance()->get_label('');

    $skill_range_table = generate_html_table_header($column_array, 238, true);
    $skill_range_table .= generate_html_table_row(Language::get_instance()->get_label('lb_pistol'),$character->get_pistol());
    $skill_range_table .= generate_html_table_row(Language::get_instance()->get_label('lb_autolauncher'),$character->get_autolauncher());
    $skill_range_table .= generate_html_table_row(Language::get_instance()->get_label('lb_launcher'),$character->get_launcher());
    $skill_range_table .= generate_html_table_row(Language::get_instance()->get_label('lb_rifle'),$character->get_rifle());
    $skill_range_table .= generate_html_table_footer();

    $content = generate_2cells_horizontal_table($skill_fight_1h_table, $skill_fight_2h_table);
    $content .= '<br>';
    $content .= $skill_range_table;

    return $content;
}

function render_character_magic_skill(Character $character){

    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_skill_offensive_magic');
    $column_array[] = Language::get_instance()->get_label('');


    $skill_offensive_magic_table = generate_html_table_header($column_array, 238, true);
    $skill_offensive_magic_table .= generate_html_table_row(Language::get_instance()->get_label('lb_elemental_magic'), $character->get_elemental_magic());
    $skill_offensive_magic_table .= generate_html_table_row(Language::get_instance()->get_label('lb_offensive_affliction'), $character->get_offensive_affiction());
    $skill_offensive_magic_table .= generate_html_table_footer();

    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_skill_defensive_magic');
    $column_array[] = Language::get_instance()->get_label('');

    $skill_defensive_magic_table = generate_html_table_header($column_array, 238, true);
    $skill_defensive_magic_table .= generate_html_table_row(Language::get_instance()->get_label('lb_healing_magic'), $character->get_healing_magic());
    $skill_defensive_magic_table .= generate_html_table_row(Language::get_instance()->get_label('lb_defensive_affliction'), $character->get_defensive_affliction());
    $skill_defensive_magic_table .= generate_html_table_footer();

    $content = $skill_offensive_magic_table;
    $content .= '<br>';
    $content .= $skill_defensive_magic_table;

    return $content;
}

function render_character_harvest_skill(Character $character){

    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_harvest');
    $column_array[] = Language::get_instance()->get_label('');

    $skill_harvest_table = generate_html_table_header($column_array, 238, true);
    $skill_harvest_table .= generate_html_table_row(Language::get_instance()->get_label('lb_char_harvest_desert'), $character->get_desert_harvest());
    $skill_harvest_table .= generate_html_table_row(Language::get_instance()->get_label('lb_char_harvest_jungle'), $character->get_jungle_harvest());
    $skill_harvest_table .= generate_html_table_row(Language::get_instance()->get_label('lb_char_harvest_lake'), $character->get_lake_harvest());
    $skill_harvest_table .= generate_html_table_row(Language::get_instance()->get_label('lb_char_harvest_prime_root'), $character->get_prime_roots_harvest());
    $skill_harvest_table .= generate_html_table_row(Language::get_instance()->get_label('lb_char_harvest_forest'), $character->get_forest_harvest());
    $skill_harvest_table .= generate_html_table_footer();

    return $skill_harvest_table;
}

function render_character_craft_armor_item_skill(Character $character){

    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_skill_craft_heavy_armor');
    $column_array[] = Language::get_instance()->get_label('');

    $skill_craft_heavy_armor = generate_html_table_header($column_array, 238, true);
    $skill_craft_heavy_armor .= generate_html_table_row(Language::get_instance()->get_label('lb_boot'), $character->get_craft_heavy_armor_boot());
    $skill_craft_heavy_armor .= generate_html_table_row(Language::get_instance()->get_label('lb_glove'), $character->get_craft_heavy_armor_glove());
    $skill_craft_heavy_armor .= generate_html_table_row(Language::get_instance()->get_label('lb_helmet'), $character->get_craft_heavy_armor_helmet());
    $skill_craft_heavy_armor .= generate_html_table_row(Language::get_instance()->get_label('lb_pant'), $character->get_craft_heavy_armor_pant());
    $skill_craft_heavy_armor .= generate_html_table_row(Language::get_instance()->get_label('lb_sleeve'), $character->get_craft_heavy_armor_sleeve());
    $skill_craft_heavy_armor .= generate_html_table_row(Language::get_instance()->get_label('lb_vest'), $character->get_craft_heavy_armor_vest());
    $skill_craft_heavy_armor .= generate_html_table_footer();

    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_skill_craft_medium_armor');
    $column_array[] = Language::get_instance()->get_label('');

    $skill_craft_medium_armor = generate_html_table_header($column_array, 238, true);
    $skill_craft_medium_armor .= generate_html_table_row(Language::get_instance()->get_label('lb_boot'), $character->get_craft_medium_armor_boot());
    $skill_craft_medium_armor .= generate_html_table_row(Language::get_instance()->get_label('lb_glove'), $character->get_craft_medium_armor_glove());
    $skill_craft_medium_armor .= generate_html_table_row(Language::get_instance()->get_label('lb_pant'), $character->get_craft_medium_armor_pant());
    $skill_craft_medium_armor .= generate_html_table_row(Language::get_instance()->get_label('lb_sleeve'), $character->get_craft_medium_armor_sleeve());
    $skill_craft_medium_armor .= generate_html_table_row(Language::get_instance()->get_label('lb_vest'), $character->get_craft_medium_armor_vest());
    $skill_craft_medium_armor .= generate_html_table_footer();

    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_skill_craft_light_armor');
    $column_array[] = Language::get_instance()->get_label('');

    $skill_craft_light_armor = generate_html_table_header($column_array, 238, true);
    $skill_craft_light_armor .= generate_html_table_row(Language::get_instance()->get_label('lb_boot'), $character->get_craft_light_armor_boot());
    $skill_craft_light_armor .= generate_html_table_row(Language::get_instance()->get_label('lb_glove'), $character->get_craft_light_armor_glove());
    $skill_craft_light_armor .= generate_html_table_row(Language::get_instance()->get_label('lb_pant'), $character->get_craft_light_armor_pant());
    $skill_craft_light_armor .= generate_html_table_row(Language::get_instance()->get_label('lb_sleeve'), $character->get_craft_light_armor_sleeve());
    $skill_craft_light_armor .= generate_html_table_row(Language::get_instance()->get_label('lb_vest'), $character->get_craft_light_armor_vest());
    $skill_craft_light_armor .= generate_html_table_footer();

    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_skill_craft_shield');
    $column_array[] = Language::get_instance()->get_label('');

    $skill_craft_shield = generate_html_table_header($column_array, 238, true);
    $skill_craft_shield .= generate_html_table_row(Language::get_instance()->get_label('lb_shield'), $character->get_craft_shield());
    $skill_craft_shield .= generate_html_table_row(Language::get_instance()->get_label('lb_large_shield'), $character->get_craft_large_shield());
    $skill_craft_shield .= generate_html_table_footer();

    $content = generate_2cells_horizontal_table($skill_craft_heavy_armor, $skill_craft_medium_armor);
    $content .= '<br>';
    $content .= generate_2cells_horizontal_table($skill_craft_light_armor, $skill_craft_shield);

    return $content;
}

function render_character_craft_other_item_skill(Character $character){

    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_skill_craft_jewel');
    $column_array[] = Language::get_instance()->get_label('');

    $skill_craft_jewel = generate_html_table_header($column_array, 238, true);
    $skill_craft_jewel .= generate_html_table_row(Language::get_instance()->get_label('lb_anklet'), $character->get_craft_jewel_anklet());
    $skill_craft_jewel .= generate_html_table_row(Language::get_instance()->get_label('lb_bracelet'), $character->get_craft_jewel_bracelet());
    $skill_craft_jewel .= generate_html_table_row(Language::get_instance()->get_label('lb_diadem'), $character->get_craft_jewel_diadem());
    $skill_craft_jewel .= generate_html_table_row(Language::get_instance()->get_label('lb_earring'), $character->get_craft_jewel_earring());
    $skill_craft_jewel .= generate_html_table_row(Language::get_instance()->get_label('lb_pendant'), $character->get_craft_jewel_pendant());
    $skill_craft_jewel .= generate_html_table_row(Language::get_instance()->get_label('lb_ring'), $character->get_craft_jewel_ring());
    $skill_craft_jewel .= generate_html_table_footer();

    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_skill_craft_1h_weapon');
    $column_array[] = Language::get_instance()->get_label('');

    $skill_craft_1h_weapon = generate_html_table_header($column_array, 238, true);
    $skill_craft_1h_weapon .= generate_html_table_row(Language::get_instance()->get_label('lb_1h_axe'), $character->get_craft_axe_1h());
    $skill_craft_1h_weapon .= generate_html_table_row(Language::get_instance()->get_label('lb_1h_dagger'), $character->get_craft_dagger_1h());
    $skill_craft_1h_weapon .= generate_html_table_row(Language::get_instance()->get_label('lb_1h_mace'), $character->get_craft_mace_1h());
    $skill_craft_1h_weapon .= generate_html_table_row(Language::get_instance()->get_label('lb_1h_spear'), $character->get_craft_spear_1h());
    $skill_craft_1h_weapon .= generate_html_table_row(Language::get_instance()->get_label('lb_1h_sword'), $character->get_craft_sword_1h());
    $skill_craft_1h_weapon .= generate_html_table_row(Language::get_instance()->get_label('lb_1h_staff'), $character->get_craft_staff_1h());
    $skill_craft_1h_weapon .= generate_html_table_footer();

    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_skill_craft_2h_weapon');
    $column_array[] = Language::get_instance()->get_label('');

    $skill_craft_2h_weapon = generate_html_table_header($column_array, 238, true);
    $skill_craft_2h_weapon .= generate_html_table_row(Language::get_instance()->get_label('lb_2h_axe'), $character->get_craft_axe_2h());
    $skill_craft_2h_weapon .= generate_html_table_row(Language::get_instance()->get_label('lb_2h_mace'), $character->get_craft_mace_2h());
    $skill_craft_2h_weapon .= generate_html_table_row(Language::get_instance()->get_label('lb_2h_pike'), $character->get_craft_pike_2h());
    $skill_craft_2h_weapon .= generate_html_table_row(Language::get_instance()->get_label('lb_2h_sword'), $character->get_craft_sword_2h());
    $skill_craft_2h_weapon .= generate_html_table_row(Language::get_instance()->get_label('lb_2h_ampli'), $character->get_craft_ampli());
    $skill_craft_2h_weapon .= generate_html_table_footer();

    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_skill_craft_range');
    $column_array[] = Language::get_instance()->get_label('');

    $skill_craft_range = generate_html_table_header($column_array, 238, true);
    $skill_craft_range .= generate_html_table_row(Language::get_instance()->get_label('lb_pistol'), $character->get_craft_pistol());
    $skill_craft_range .= generate_html_table_row(Language::get_instance()->get_label('lb_autolauncher'), $character->get_craft_autolauncher());
    $skill_craft_range .= generate_html_table_row(Language::get_instance()->get_label('lb_launcher'), $character->get_craft_launcher());
    $skill_craft_range .= generate_html_table_row(Language::get_instance()->get_label('lb_rifle'), $character->get_craft_rifle());
    $skill_craft_range .= generate_html_table_footer();



    $content = generate_2cells_horizontal_table($skill_craft_1h_weapon, $skill_craft_2h_weapon);
    $content .= '<br>';
    $content .= generate_2cells_horizontal_table($skill_craft_range, $skill_craft_jewel) ;

    return $content;
}

function render_character_statistics(Character $character){
    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_primary_stats');
    $column_array[] = Language::get_instance()->get_label('');

    $primary_stats_table = generate_html_table_header($column_array, 238, true);
    $primary_stats_table .= generate_html_table_row(Language::get_instance()->get_label('lb_constitution'), $character->get_constitution());
    $primary_stats_table .= generate_html_table_row(Language::get_instance()->get_label('lb_strength'), $character->get_strength());
    $primary_stats_table .= generate_html_table_row(Language::get_instance()->get_label('lb_intelligence'), $character->get_intelligence());
    $primary_stats_table .= generate_html_table_row(Language::get_instance()->get_label('lb_dexterity'), $character->get_dexterity());
    $primary_stats_table .= generate_html_table_footer();

    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_secondary_stats');
    $column_array[] = Language::get_instance()->get_label('');

    $secondary_stats_table = generate_html_table_header($column_array, 238, true);
    $secondary_stats_table .= generate_html_table_row(Language::get_instance()->get_label('lb_metabolism'), $character->get_metabolism());
    $secondary_stats_table .= generate_html_table_row(Language::get_instance()->get_label('lb_wellbalanced'), $character->get_wellbalanced());
    $secondary_stats_table .= generate_html_table_row(Language::get_instance()->get_label('lb_wisdom'), $character->get_wisdom());
    $secondary_stats_table .= generate_html_table_row(Language::get_instance()->get_label('lb_will'), $character->get_will());
    $secondary_stats_table .= generate_html_table_footer();

    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_bars');
    $column_array[] = Language::get_instance()->get_label('');

    $bars_table = generate_html_table_header($column_array, 238, true);
    $bars_table .= generate_html_table_row(Language::get_instance()->get_label('lb_hit_point'), $character->get_hit_points());
    $bars_table .= generate_html_table_row(Language::get_instance()->get_label('lb_stamina'), $character->get_stamina());
    $bars_table .= generate_html_table_row(Language::get_instance()->get_label('lb_sap'), $character->get_sap());
    $bars_table .= generate_html_table_row(Language::get_instance()->get_label('lb_focus'), $character->get_focus());
    $bars_table .= generate_html_table_footer();

    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_regen_stats');
    $column_array[] = Language::get_instance()->get_label('');
    
    $regen_stats_table = generate_html_table_header($column_array, 238, true);
    $regen_stats_table .= generate_html_table_row(Language::get_instance()->get_label('lb_regen_hit_points'), $character->get_hit_points_regen());
    $regen_stats_table .= generate_html_table_row(Language::get_instance()->get_label('lb_regen_stamina'), $character->get_stamina_regen());
    $regen_stats_table .= generate_html_table_row(Language::get_instance()->get_label('lb_regen_sap'), $character->get_sap_regen());
    $regen_stats_table .= generate_html_table_row(Language::get_instance()->get_label('lb_regen_focus'), $character->get_focus_regen());
    $regen_stats_table .= generate_html_table_footer();

    $content = generate_2cells_horizontal_table($primary_stats_table, $bars_table);
    $content .= '<br>';
    $content .= generate_2cells_horizontal_table($secondary_stats_table, $regen_stats_table);

    return $content;
}

function render_character_fame(Character $character){

    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_faction_fame');
    $column_array[] = Language::get_instance()->get_label('');

    $faction_fame_table = generate_html_table_header($column_array, 238, true);
    $faction_fame_table .= generate_html_table_row(Language::get_instance()->get_label('lb_fyros'), $character->get_fyros_fame());
    $faction_fame_table .= generate_html_table_row(Language::get_instance()->get_label('lb_matis'), $character->get_matis_fame());
    $faction_fame_table .= generate_html_table_row(Language::get_instance()->get_label('lb_tryker'), $character->get_tryker_fame());
    $faction_fame_table .= generate_html_table_row(Language::get_instance()->get_label('lb_zorai'), $character->get_zorai_fame());
    $faction_fame_table .= generate_html_table_row(Language::get_instance()->get_label('lb_kami'), $character->get_kami_fame());
    $faction_fame_table .= generate_html_table_row(Language::get_instance()->get_label('lb_karavan'), $character->get_karavan_fame());
    $faction_fame_table .= generate_html_table_footer();

    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_faction_point');
    $column_array[] = Language::get_instance()->get_label('');

    $faction_point_table = generate_html_table_header($column_array, 238, true);
    $faction_point_table .= generate_html_table_row(Language::get_instance()->get_label('lb_fyros'), $character->get_fyros_faction_point());
    $faction_point_table .= generate_html_table_row(Language::get_instance()->get_label('lb_matis'), $character->get_matis_faction_point());
    $faction_point_table .= generate_html_table_row(Language::get_instance()->get_label('lb_tryker'), $character->get_tryker_faction_point());
    $faction_point_table .= generate_html_table_row(Language::get_instance()->get_label('lb_zorai'), $character->get_zorai_faction_point());
    $faction_point_table .= generate_html_table_row(Language::get_instance()->get_label('lb_kami'), $character->get_kami_faction_point());
    $faction_point_table .= generate_html_table_row(Language::get_instance()->get_label('lb_karavan'), $character->get_karavan_faction_point());
    $faction_point_table .= generate_html_table_footer();

    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_tribe_fame');
    $column_array[] = Language::get_instance()->get_label('');

    $tribe_fame_table = generate_html_table_header($column_array, 238, true);
    $tribe_fame_table .= generate_html_table_row(Language::get_instance()->get_label('lb_tribe_darkening_sap'), $character->get_tribe_darkening_sap_fame());
    $tribe_fame_table .= generate_html_table_row(Language::get_instance()->get_label('lb_tribe_lawless'), $character->get_tribe_lawless_fame());
    $tribe_fame_table .= generate_html_table_row(Language::get_instance()->get_label('lb_tribe_leviers'), $character->get_tribe_leviers_fame());
    $tribe_fame_table .= generate_html_table_row(Language::get_instance()->get_label('lb_tribe_master_goo'), $character->get_tribe_master_of_the_goo_fame());
    $tribe_fame_table .= generate_html_table_row(Language::get_instance()->get_label('lb_tribe_restorers'), $character->get_tribe_restorers_fame());
    $tribe_fame_table .= generate_html_table_row(Language::get_instance()->get_label('lb_tribe_scorchers'), $character->get_tribe_scorchers_fame());
    $tribe_fame_table .= generate_html_table_row(Language::get_instance()->get_label('lb_water_breakers'), $character->get_tribe_water_breakers_fame());
    $tribe_fame_table .= generate_html_table_footer();
    
    $content = generate_2cells_horizontal_table($faction_fame_table, $faction_point_table);
    $content .= '<br>';
    $content .= $tribe_fame_table;
    $content .= '<br>';
    $content .= Language::get_instance()->get_label('lb_pvp_ally').' : <br>TO IMPLEMENT';

    return $content;
}

function render_character_connection_infos(Character $character){
    $column_array = array();
    $column_array[] = Language::get_instance()->get_label('lb_connection_info');
    $column_array[] = Language::get_instance()->get_label('');

    $connection_info_table = generate_html_table_header($column_array, 350, true);
    $connection_info_table .= generate_html_table_row(Language::get_instance()->get_label('lb_played_time'), $character->get_played_time());
    $connection_info_table .= generate_html_table_row(Language::get_instance()->get_label('lb_latest_login'), $character->get_latest_login());
    $connection_info_table .= generate_html_table_row(Language::get_instance()->get_label('lb_latest_logout'), $character->get_latest_logout());
    $connection_info_table .= generate_html_table_footer();

    //TODO : remove comment when get_latest_connection() is working
    //$content .= Language::get_instance()->get_label('lb_char_latest_connection').' : '.$character->get_latest_connection();

    return $connection_info_table;
}

function render_character_dressingRoom_lfstyle(Character $character){
    $url = '';

    if ($character->get_race() != null){
        $url .= '<img src="http://ballisticmystix.net/api/dressingroom.php?race='.$character->get_race()
        .'&gender='.$character->get_gender()
        .'&hair='.$character->get_hair_type().'/'.$character->get_hair_color()
        .'&tattoo='.$character->get_tattoo()
        .'&eyes='.$character->get_eyes_color();
//        .'&morph='.$character->get_morph1().','.$character->get_morph2().','.$character->get_morph3().','.$character->get_morph4().','.$character->get_morph5().','.$character->get_morph6().','.$character->get_morph7().','.$character->get_morph8()
//        .'&gabarit='.$character->get_gabarit_height()
//        .','.$character->get_gabarit_torso_width()
//        .','.$character->get_gabarit_arms_width()
//        .','.$character->get_gabarit_legs_width()
//        .','.$character->get_gabarit_breast_size();

        if ($character->get_grade_id() == Guild_Member::GUILD_MEMBER_GRADE_ID){
            $url .= '&chest=icfahv_3/0&arms=icfahs_3/0&hands=icfahg_3/0&feet=icfahb_3/0&legs=icfahp_3/0" />';
        }
        else {
            $url .= '&chest=icfahv_3/7&arms=icfahs_3/7&hands=icfahg_3/7&feet=icfahb_3/7&legs=icfahp_3/7" />';
        }
        
    }
    return $url;
}

function generate_member_fight_skill_table($member_array){
    $column_array = array();
    $column_with_colspan = array();

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_general'),2);
    $column_array[] = Language::get_instance()->get_label('lb_name');
    $column_array[] = Language::get_instance()->get_label('lb_grade');

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_skill_fight_2h'),4);
    $column_array[] = '<img class="icon2" src="img/skill_icons/2h_ax.png" title="'.Language::get_instance()->get_label('lb_2h_axe').'" />';//Language::get_instance()->get_label('lb_2h_axe');
    $column_array[] = '<img class="icon2" src="img/skill_icons/2h_ma.png" title="'.Language::get_instance()->get_label('lb_2h_mace').'" />';//Language::get_instance()->get_label('lb_2h_mace');
    $column_array[] = '<img class="icon2" src="img/skill_icons/2h_pi.png" title="'.Language::get_instance()->get_label('lb_2h_pike').'" />';//Language::get_instance()->get_label('lb_2h_pike');
    $column_array[] = '<img class="icon2" src="img/skill_icons/2h_sw.png" title="'.Language::get_instance()->get_label('lb_2h_sword').'" />';//Language::get_instance()->get_label('lb_2h_sword');

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_skill_fight_1h'),7);
    $column_array[] = '<img class="icon2" src="img/skill_icons/1h_ax.png" title="'.Language::get_instance()->get_label('lb_1h_axe').'" />';//Language::get_instance()->get_label('lb_1h_axe');
    $column_array[] = '<img class="icon2" src="img/skill_icons/1h_da.png" title="'.Language::get_instance()->get_label('lb_1h_dagger').'" />';//Language::get_instance()->get_label('lb_1h_dagger');
    $column_array[] = '<img class="icon2" src="img/skill_icons/1h_ma.png" title="'.Language::get_instance()->get_label('lb_1h_mace').'" />';//Language::get_instance()->get_label('lb_1h_mace');
    $column_array[] = '<img class="icon2" src="img/skill_icons/1h_sp.png" title="'.Language::get_instance()->get_label('lb_1h_spear').'" />';//Language::get_instance()->get_label('lb_1h_spear');
    $column_array[] = '<img class="icon2" src="img/skill_icons/1h_st.png" title="'.Language::get_instance()->get_label('lb_1h_staff').'" />';//Language::get_instance()->get_label('lb_1h_staff');
    $column_array[] = '<img class="icon2" src="img/skill_icons/1h_sw.png" title="'.Language::get_instance()->get_label('lb_1h_sword').'" />';//Language::get_instance()->get_label('lb_1h_sword');
    $column_array[] = '<img class="icon2" src="img/skill_icons/2h_am.png" title="'.Language::get_instance()->get_label('lb_hand_to_hand').'" />';//Language::get_instance()->get_label('lb_hand_to_hand');

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_skill_range'),4);
    $column_array[] = '<img class="icon2" src="img/skill_icons/2h_au.png" title="'.Language::get_instance()->get_label('lb_autolauncher').'" />';//Language::get_instance()->get_label('lb_autolauncher');
    $column_array[] = '<img class="icon2" src="img/skill_icons/2h_la.png" title="'.Language::get_instance()->get_label('lb_launcher').'" />';//Language::get_instance()->get_label('lb_launcher');
    $column_array[] = '<img class="icon2" src="img/skill_icons/1h_pi.png" title="'.Language::get_instance()->get_label('lb_pistol').'" />';//Language::get_instance()->get_label('lb_pistol');
    $column_array[] = '<img class="icon2" src="img/skill_icons/2h_ri.png" title="'.Language::get_instance()->get_label('lb_rifle').'" />';//Language::get_instance()->get_label('lb_rifle');

    $content = generate_html_sortable_table_header($column_array, $column_with_colspan);


    foreach($member_array as $member){
        $content .= '<tr>';
        $content .= generate_member_name_and_grade($member);
        $content .= '<td>'.$member->get_axe_2h().'</td>';
        $content .= '<td>'.$member->get_mace_2h().'</td>';
        $content .= '<td>'.$member->get_pike_2h().'</td>';
        $content .= '<td>'.$member->get_sword_2h().'</td>';
        
        $content .= '<td>'.$member->get_axe_1h().'</td>';
        $content .= '<td>'.$member->get_dagger_1h().'</td>';
        $content .= '<td>'.$member->get_mace_1h().'</td>';
        $content .= '<td>'.$member->get_spear_1h().'</td>';
        $content .= '<td>'.$member->get_staff_1h().'</td>';
        $content .= '<td>'.$member->get_sword_1h().'</td>';
        $content .= '<td>'.$member->get_hand_to_hand().'</td>';

        $content .= '<td>'.$member->get_autolauncher().'</td>';
        $content .= '<td>'.$member->get_launcher().'</td>';
        $content .= '<td>'.$member->get_pistol().'</td>';
        $content .= '<td>'.$member->get_rifle().'</td>';
        
        $content .= '</tr>';
    }


    $content .= generate_html_table_footer();


    return $content;
}

function generate_member_magic_skill_table($member_array){
    $column_array = array();
    $column_with_colspan = array();

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_general'),2);
    $column_array[] = Language::get_instance()->get_label('lb_name');
    $column_array[] = Language::get_instance()->get_label('lb_grade');

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_magic'),4);
    $column_array[] = '<img class="icon2" src="img/skill_icons/elem_magic.png" title="'.Language::get_instance()->get_label('lb_elemental_magic').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/off_aflic3.png" title="'.Language::get_instance()->get_label('lb_offensive_affliction').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/heal_magic.png" title="'.Language::get_instance()->get_label('lb_healing_magic').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/def_afflic.png" title="'.Language::get_instance()->get_label('lb_defensive_affliction').'" />';

    $content = generate_html_sortable_table_header($column_array, $column_with_colspan);
    
    foreach($member_array as $member){
        $content .= '<tr>';
        $content .= generate_member_name_and_grade($member);
        $content .= '<td>'.$member->get_elemental_magic().'</td>';
        $content .= '<td>'.$member->get_offensive_affiction().'</td>';
        $content .= '<td>'.$member->get_healing_magic().'</td>';
        $content .= '<td>'.$member->get_defensive_affliction().'</td>';
        $content .= '</tr>';
    }

    
    $content .= generate_html_table_footer();


    return $content;
}

function generate_member_harvest_skill_table($member_array){
    $column_array = array();
    $column_with_colspan = array();

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_general'),2);
    $column_array[] = Language::get_instance()->get_label('lb_name');
    $column_array[] = Language::get_instance()->get_label('lb_grade');

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_harvest'),5);
    $column_array[] = '<img class="icon2" src="img/skill_icons/desert.jpg" title="'.Language::get_instance()->get_label('lb_char_harvest_desert').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/forest.jpg" title="'.Language::get_instance()->get_label('lb_char_harvest_forest').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/jungle.jpg" title="'.Language::get_instance()->get_label('lb_char_harvest_jungle').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/lake.jpg" title="'.Language::get_instance()->get_label('lb_char_harvest_lake').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/prime_roots.jpg" title="'.Language::get_instance()->get_label('lb_char_harvest_prime_root').'" />';

    $content = generate_html_sortable_table_header($column_array, $column_with_colspan);

    foreach($member_array as $member){
        $content .= '<tr>';
        $content .= generate_member_name_and_grade($member);
        $content .= '<td>'.$member->get_desert_harvest().'</td>';
        $content .= '<td>'.$member->get_forest_harvest().'</td>';
        $content .= '<td>'.$member->get_jungle_harvest().'</td>';
        $content .= '<td>'.$member->get_lake_harvest().'</td>';
        $content .= '<td>'.$member->get_prime_roots_harvest().'</td>';
        $content .= '</tr>';
    }

    $content .= generate_html_table_footer();

    return $content;
}

function generate_member_armor_craft_skill_table($member_array){
    $column_array = array();
    $column_with_colspan = array();

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_general'),2);
    $column_array[] = Language::get_instance()->get_label('lb_name');
    $column_array[] = Language::get_instance()->get_label('lb_grade');

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_skill_craft_heavy_armor'),6);
    $column_array[] = '<img class="icon2" src="img/skill_icons/h_b.png" title="'.Language::get_instance()->get_label('lb_heavy_boot').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/h_g.png" title="'.Language::get_instance()->get_label('lb_heavy_glove').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/h_h.png" title="'.Language::get_instance()->get_label('lb_heavy_helmet').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/h_p.png" title="'.Language::get_instance()->get_label('lb_heavy_pant').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/h_s.png" title="'.Language::get_instance()->get_label('lb_heavy_sleeve').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/h_v.png" title="'.Language::get_instance()->get_label('lb_heavy_vest').'" />';

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_skill_craft_medium_armor'),5);
    $column_array[] = '<img class="icon2" src="img/skill_icons/m_b.png" title="'.Language::get_instance()->get_label('lb_medium_boot').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/m_g.png" title="'.Language::get_instance()->get_label('lb_medium_glove').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/m_p.png" title="'.Language::get_instance()->get_label('lb_medium_pant').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/m_s.png" title="'.Language::get_instance()->get_label('lb_medium_sleeve').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/m_v.png" title="'.Language::get_instance()->get_label('lb_medium_vest').'" />';

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_skill_craft_light_armor'),5);
    $column_array[] = '<img class="icon2" src="img/skill_icons/l_b.png" title="'.Language::get_instance()->get_label('lb_light_boot').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/l_g.png" title="'.Language::get_instance()->get_label('lb_light_glove').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/l_p.png" title="'.Language::get_instance()->get_label('lb_light_pant').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/l_s.png" title="'.Language::get_instance()->get_label('lb_light_sleeve').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/l_v.png" title="'.Language::get_instance()->get_label('lb_light_vest').'" />';

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_skill_craft_shield'),2);
    $column_array[] = '<img class="icon2" src="img/skill_icons/1m_bs.png" title="'.Language::get_instance()->get_label('lb_shield').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/1h_sb.png" title="'.Language::get_instance()->get_label('lb_large_shield').'" />';


    $content = generate_html_sortable_table_header($column_array, $column_with_colspan);

    foreach($member_array as $member){
        $content .= '<tr>';
        $content .= generate_member_name_and_grade($member);
        $content .= '<td>'.$member->get_craft_heavy_armor_boot().'</td>';
        $content .= '<td>'.$member->get_craft_heavy_armor_glove().'</td>';
        $content .= '<td>'.$member->get_craft_heavy_armor_helmet().'</td>';
        $content .= '<td>'.$member->get_craft_heavy_armor_pant().'</td>';
        $content .= '<td>'.$member->get_craft_heavy_armor_sleeve().'</td>';
        $content .= '<td>'.$member->get_craft_heavy_armor_vest().'</td>';

        $content .= '<td>'.$member->get_craft_medium_armor_boot().'</td>';
        $content .= '<td>'.$member->get_craft_medium_armor_glove().'</td>';
        $content .= '<td>'.$member->get_craft_medium_armor_pant().'</td>';
        $content .= '<td>'.$member->get_craft_medium_armor_sleeve().'</td>';
        $content .= '<td>'.$member->get_craft_medium_armor_vest().'</td>';

        $content .= '<td>'.$member->get_craft_light_armor_boot().'</td>';
        $content .= '<td>'.$member->get_craft_light_armor_glove().'</td>';
        $content .= '<td>'.$member->get_craft_light_armor_pant().'</td>';
        $content .= '<td>'.$member->get_craft_light_armor_sleeve().'</td>';
        $content .= '<td>'.$member->get_craft_light_armor_vest().'</td>';

        $content .= '<td>'.$member->get_craft_shield().'</td>';
        $content .= '<td>'.$member->get_craft_large_shield().'</td>';
        $content .= '</tr>';
    }

    $content .= generate_html_table_footer();

    return $content;
}

function generate_member_other_craft_skill_table($member_array){
    $column_array = array();
    $column_with_colspan = array();

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_general'),2);
    $column_array[] = Language::get_instance()->get_label('lb_name');
    $column_array[] = Language::get_instance()->get_label('lb_grade');

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_skill_craft_jewel'),6);
    $column_array[] = '<img class="icon2" src="img/skill_icons/j_an.png" title="'.Language::get_instance()->get_label('lb_anklet').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/j_br.png" title="'.Language::get_instance()->get_label('lb_bracelet').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/j_di.png" title="'.Language::get_instance()->get_label('lb_diadem').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/j_ea.png" title="'.Language::get_instance()->get_label('lb_earring').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/j_pe.png" title="'.Language::get_instance()->get_label('lb_pendant').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/j_ri.png" title="'.Language::get_instance()->get_label('lb_ring').'" />';

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_skill_craft_2h_weapon'),5);
    $column_array[] = '<img class="icon2" src="img/skill_icons/2h_ax.png" title="'.Language::get_instance()->get_label('lb_2h_axe').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/2h_ma.png" title="'.Language::get_instance()->get_label('lb_2h_mace').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/2h_pi.png" title="'.Language::get_instance()->get_label('lb_2h_pike').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/2h_sw.png" title="'.Language::get_instance()->get_label('lb_2h_sword').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/2h_am.png" title="'.Language::get_instance()->get_label('lb_2h_ampli').'" />';

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_skill_craft_1h_weapon'),6);
    $column_array[] = '<img class="icon2" src="img/skill_icons/1h_ax.png" title="'.Language::get_instance()->get_label('lb_1h_axe').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/1h_da.png" title="'.Language::get_instance()->get_label('lb_1h_dagger').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/1h_ma.png" title="'.Language::get_instance()->get_label('lb_1h_mace').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/1h_sp.png" title="'.Language::get_instance()->get_label('lb_1h_spear').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/1h_sw.png" title="'.Language::get_instance()->get_label('lb_1h_sword').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/1h_st.png" title="'.Language::get_instance()->get_label('lb_1h_staff').'" />';

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_skill_craft_range'),4);
    $column_array[] = '<img class="icon2" src="img/skill_icons/2h_au.png" title="'.Language::get_instance()->get_label('lb_autolauncher').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/2h_la.png" title="'.Language::get_instance()->get_label('lb_launcher').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/1h_pi.png" title="'.Language::get_instance()->get_label('lb_pistol').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/2h_ri.png" title="'.Language::get_instance()->get_label('lb_rifle').'" />';

    $content = generate_html_sortable_table_header($column_array, $column_with_colspan);

    foreach($member_array as $member){
        $content .= '<tr>';
        $content .= generate_member_name_and_grade($member);
        $content .= '<td>'.$member->get_craft_jewel_anklet().'</td>';
        $content .= '<td>'.$member->get_craft_jewel_bracelet().'</td>';
        $content .= '<td>'.$member->get_craft_jewel_diadem().'</td>';
        $content .= '<td>'.$member->get_craft_jewel_earring().'</td>';
        $content .= '<td>'.$member->get_craft_jewel_pendant().'</td>';
        $content .= '<td>'.$member->get_craft_jewel_ring().'</td>';
        
        $content .= '<td>'.$member->get_craft_axe_2h().'</td>';
        $content .= '<td>'.$member->get_craft_mace_2h().'</td>';
        $content .= '<td>'.$member->get_craft_pike_2h().'</td>';
        $content .= '<td>'.$member->get_craft_sword_2h().'</td>';
        $content .= '<td>'.$member->get_craft_ampli().'</td>';
        
        $content .= '<td>'.$member->get_craft_axe_1h().'</td>';
        $content .= '<td>'.$member->get_craft_dagger_1h().'</td>';
        $content .= '<td>'.$member->get_craft_mace_1h().'</td>';
        $content .= '<td>'.$member->get_craft_spear_1h().'</td>';
        $content .= '<td>'.$member->get_craft_sword_1h().'</td>';
        $content .= '<td>'.$member->get_craft_staff_1h().'</td>';
        
        $content .= '<td>'.$member->get_craft_autolauncher().'</td>';
        $content .= '<td>'.$member->get_craft_launcher().'</td>';
        $content .= '<td>'.$member->get_craft_pistol().'</td>';
        $content .= '<td>'.$member->get_craft_rifle().'</td>';
        $content .= '</tr>';
    }


    $content .= generate_html_table_footer();


    return $content;
    
}

function generate_member_statistics_table($member_array){
    $column_array = array();
    $column_with_colspan = array();

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_general'),2);
    $column_array[] = Language::get_instance()->get_label('lb_name');
    $column_array[] = Language::get_instance()->get_label('lb_grade');

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_primary_stats'),4);
    $column_array[] = '<img class="icon2" src="img/skill_icons/constitution.png" title="'.Language::get_instance()->get_label('lb_constitution').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/strength.png" title="'.Language::get_instance()->get_label('lb_strength').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/intelligence.png" title="'.Language::get_instance()->get_label('lb_intelligence').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/dexterity.png" title="'.Language::get_instance()->get_label('lb_dexterity').'" />';

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_regen_stats'),4);
    $column_array[] = '<img class="icon2" src="img/skill_icons/metabolism.png" title="'.Language::get_instance()->get_label('lb_metabolism').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/wellbalanced.png" title="'.Language::get_instance()->get_label('lb_wellbalanced').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/wisdom.png" title="'.Language::get_instance()->get_label('lb_wisdom').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/will.png" title="'.Language::get_instance()->get_label('lb_will').'" />';

    $content = generate_html_sortable_table_header($column_array, $column_with_colspan);

    foreach($member_array as $member){
        $content .= '<tr>';
        $content .= generate_member_name_and_grade($member);
        $content .= '<td>'.$member->get_constitution().'</td>';
        $content .= '<td>'.$member->get_strength().'</td>';
        $content .= '<td>'.$member->get_intelligence().'</td>';
        $content .= '<td>'.$member->get_dexterity().'</td>';
        $content .= '<td>'.$member->get_metabolism().'</td>';
        $content .= '<td>'.$member->get_wellbalanced().'</td>';
        $content .= '<td>'.$member->get_wisdom().'</td>';
        $content .= '<td>'.$member->get_will().'</td>';
        $content .= '</tr>';
    }

    $content .= generate_html_table_footer();

    return $content;
}

function generate_member_fame_table($member_array){
    $column_array = array();
    $column_with_colspan = array();

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_general'),2);
    $column_array[] = Language::get_instance()->get_label('lb_name');
    $column_array[] = Language::get_instance()->get_label('lb_grade');

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_allegiance'),2);
    $column_array[] = Language::get_instance()->get_label('lb_civilization');
    $column_array[] = Language::get_instance()->get_label('lb_cult');

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_fame'),6);
    $column_array[] = '<img class="icon2" src="img/skill_icons/fyros.jpg" title="'.Language::get_instance()->get_label('lb_fyros').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/matis.jpg" title="'.Language::get_instance()->get_label('lb_matis').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/kami.png" title="'.Language::get_instance()->get_label('lb_kami').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/karavan.jpg" title="'.Language::get_instance()->get_label('lb_karavan').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/tryker.png" title="'.Language::get_instance()->get_label('lb_tryker').'" />';
    $column_array[] = '<img class="icon2" src="img/skill_icons/zorai.jpg" title="'.Language::get_instance()->get_label('lb_zorai').'" />';

    $content = generate_html_sortable_table_header($column_array, $column_with_colspan);

    foreach($member_array as $member){
        $content .= '<tr>';
        $content .= '<td>'.$member->get_name().'</td>';
        $content .= '<td>'.Character::get_grade_label($member->get_id()).'</td>';
        $content .= '<td>'.$member->get_civilization().'</td>';
        $content .= '<td>'.$member->get_cult().'</td>';
        $content .= '<td>'.$member->get_fyros_fame().'</td>';
        $content .= '<td>'.$member->get_matis_fame().'</td>';
        $content .= '<td>'.$member->get_kami_fame().'</td>';
        $content .= '<td>'.$member->get_karavan_fame().'</td>';
        $content .= '<td>'.$member->get_tryker_fame().'</td>';
        $content .= '<td>'.$member->get_zorai_fame().'</td>';
        $content .= '</tr>';
    }

    $content .= generate_html_table_footer();

    return $content;
}

function generate_member_connection_info_table($member_array){

    $column_array = array();
    $column_with_colspan = array();

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_general'),2);
    $column_array[] = Language::get_instance()->get_label('lb_name');
    $column_array[] = Language::get_instance()->get_label('lb_grade');

    $column_with_colspan[] = array(Language::get_instance()->get_label('lb_connection_info'),3);
    $column_array[] = Language::get_instance()->get_label('lb_played_time');
    $column_array[] = Language::get_instance()->get_label('lb_latest_login');
    $column_array[] = Language::get_instance()->get_label('lb_latest_logout');

    $content = generate_html_sortable_table_header($column_array, $column_with_colspan);

    foreach($member_array as $member){
        $content .= '<tr>';
        $content .= '<td>'.$member->get_name().'</td>';
        $content .= '<td>'.Character::get_grade_label($member->get_grade_id()).'</td>';
        $content .= '<td>'.$member->get_played_time().'</td>';
        $content .= '<td>'.$member->get_latest_login().'</td>';
        $content .= '<td>'.$member->get_latest_logout().'</td>';;
        $content .= '</tr>';
    }

    $content .= generate_html_table_footer();

    return $content;
}

function generate_member_name_and_grade($member){
    return '<td><a href="character.php?id='.$member->get_id().'">'.$member->get_name().'</a></td>'
            .'<td>'.Character::get_grade_label($member->get_grade_id()).'</td>';

}

?>
